<template>
  <div class="processCenter" style="height: 390px;">
    <el-card class="processCenter">
      <div slot="header" class="attributes">
        <img src="@/assets/images/dbgz.png" class="dbgz">
        <b>流程中心</b>
        <el-button style="float: right; padding: 3px 0;color: #768893;" type="text">更多</el-button>
      </div>
      <el-tabs
        v-model="activeName"
        @tab-click="handleTabsClick"
      >
        <el-tab-pane :label="tabLabel" name="first" v-loading="loading">
          <div v-if="!dataList.length " class="nodata">
            <el-image style="width: 62px; height: 62px" :src="require('@/assets/images/empty__image@2x.png')" />
            <p style="padding: 0; margin: 0; font-size: 12px;color:#C0C4CC;margin-top:8px;">暂无信息</p>
          </div>
          <div v-else>
            <div v-for="(item,index) in dataList " :key="index" class="messagebox" @click="getDetail(item)">
              <div class="me-left">
                <span class="dot">`</span>
                <span class="messagetitle">{{ item.noticeTitle }}</span>
              </div>
              <div class="item-time">{{ parseTime(item.createTime, '{y}-{m}-{d}') }}</div>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="tabLabel2" name="second" v-loading="loading2">
          <div v-if="!dataList2.length " class="nodata">
            <el-image style="width: 62px; height: 62px" :src="require('@/assets/images/empty__image@2x.png')" />
            <p style=" padding: 0; margin: 0; font-size: 12px;color:#C0C4CC;margin-top:8px;">暂无信息</p>
          </div>
          <div v-else>
            <div v-for="(item,index) in dataList2" :key="index" class="messagebox" @click="getDetail(item)">
              <div class="me-left">
                <span class="dot">`</span>
                <span class="messagetitle">{{ item.noticeTitle }}</span>
              </div>
              <div class="item-time">{{ parseTime(item.createTime, '{y}-{m}-{d}') }}</div>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="tabLabel3" name="third" v-loading="loading3">
          <div v-if="!dataList3.length " class="nodata">
            <el-image style="width: 62px; height: 62px" :src="require('@/assets/images/empty__image@2x.png')" />
            <p style=" padding: 0; margin: 0; font-size: 12px;color:#C0C4CC;margin-top:8px;">暂无信息</p>
          </div>
          <div v-else>
            <div v-for="(item,index) in dataList3" :key="index" class="messagebox" @click="getDetail(item)">
              <div class="me-left">
                <span class="dot">`</span>
                <span class="messagetitle">{{ item.noticeTitle }}</span>
              </div>
              <div class="item-time">{{ parseTime(item.createTime, '{y}-{m}-{d}') }}</div>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
      <el-pagination
        small
        layout="prev, pager, next"
        :total="50">
      </el-pagination>
    </el-card>
  </div>
</template>
<script >
import { allList, getNotice } from "@/api/system/notice";
export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      loading2: true,
      loading3: true,
      activeName: 'first',
      dataList: [],
      dataList2: [],
      dataList3: [],
      tabLabel: '待办（0）',
      tabLabel2: '已办',
      tabLabel3: '我的',
      // 表单参数
      form: {},
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getDetail(item) {
      this.$message.warning('正在开发中，敬请期待')
    },
    handleTabsClick(tab, event) {
      if (this.activeName == 'first') {
        this.dataList = []
        this.getNotice()
      } else if(this.activeName == 'second'){
        this.dataList2 = []
        this.getNotice2()
      } else if(this.activeName == 'third'){
        this.dataList3 = []
        this.getNotice3()
      }
    },
    getList() {
      this.getNotice()
    },
    getNotice() {
      this.loading = true;
      var response = [
        { noticeTitle: "XXX的请假申请", createTime: "2025-08-08 22:22:22" },
        { noticeTitle: "SSS的请假申请", createTime: "2025-08-09 22:22:22" },
        { noticeTitle: "FFF的请假申请", createTime: "2025-08-10 22:22:22" }
      ]
      this.dataList = response
      this.tabLabel = '待办（' + response.length + '）'
      this.loading = false;
    },
    getNotice2() {

    },
    getNotice3() {

    }
  }
}
</script>
<style lang="scss" scoped>
  .processCenter {
    width: 100%;
    height: 100%;
    background: #fff;
    .el-card__body{
      height: 100% !important;
      display: flex;
      flex-direction: column;
      overflow: hidden!important;
      .el-tabs{
        height: calc(100% - 0px);
        .el-tabs__content{
          height: 100%;
          overflow: hidden;
          .el-tab-pane{
            height: 120px;
            overflow-y: auto;
          }
        }
      }
    }
    .el-tabs{
      flex: 1;
      display: flex;
      flex-direction: column;
    }
    .nodata{
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .messagebox{
      margin: 0 0 20px;
      display: flex;
      align-items: center;
      cursor: pointer;
      .me-left{
        flex: 1;
        display: flex;
        align-items: center;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        margin-right: 20px;
        font-size: 14px;
      }
      .item-time{
        width: 85px;
        font-size: 14px;
        font-weight: 300;
        color: #909399;
      }
      &:hover {
        opacity:0.6;
      }
    }
    .dot {
      color: #F56C6C;
      width:5px;
      height: 5px;
      background: #F56C6C;
      border-radius: 50%;
      margin-right: 10px;
      text-align: center;
    }
    .messagetitle{
      min-width: 400px;
      width: 400px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      color: #606266;
    }
  }
  ::v-deep .el-tabs__nav-wrap::after{
    height: 1px;
  }
  .dbgz{
    border: 0px;
    border-radius: 5px;
    width: 18px;
    height: 18px;
    margin-right: 5px;
    vertical-align: middle;
  }
</style>
<style scoped>
 .processCenter /deep/ .el-card__body{
    height: 100% !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0px 20px 20px 20px;
 }
 .processCenter  /deep/ .el-card__header {
   border-bottom: none;
 }

</style>
